/*   time:2019-06-13 20:39:24*/
var a = getApp(),
    e = a.requirejs("core"),
    t = a.requirejs("foxui"),
    n = a.requirejs("jquery");
Page({
    data: {
        loading: !0,
        objectArray: [],
        checkedIndex: 1,
        checked: {},
        bankChecked: {},
        money: 0,
        chargeShow: !1,
        disabled: !0,
        info: {},
        realInfo: {},
        list:[],
        type:1,
        zhiprice:0.00,
        jianprice:0.00,
        tuanprice:0.00,
        ablemoney:0.00
    },
    onShow: function(e) {
        a.url(e), this.getreward(),this.getrewardSum(),this.getablemoneySum(), this.setData({
            isSubmit: !1
        })
    },
    onPullDownRefresh: function() {
        wx.stopPullDownRefresh()
    },
    getablemoneySum: function(){
        var i = this;
        console.log(i)
        e.get("commission/getablemoneySum", {status:0}, function(a) {
            console.log(a.data)
            i.setData({
                ablemoney:a.data
            })
        })
    },
    getrewardSum: function(){
        var i = this;
        console.log(i)
        e.get("commission/getrewardSum", {}, function(a) {
            var t = {
                zhiprice:0.00,
                jianprice:0.00,
                tuanprice:0.00
            }
            for(let d=0;d<a.data.length;d++){
                if(a.data[d].ly_type==1){
                    t.zhiprice = a.data[d].allreward
                }
                if(a.data[d].ly_type==2){
                    t.jianprice = a.data[d].allreward
                }
                if(a.data[d].ly_type==3){
                    t.tuanprice = a.data[d].allreward
                }
            }
            console.log(t)
            i.setData(t)
        })
    },
    getreward: function() {
        var i = this;
        console.log(i)
        e.get("commission/getreward", {type:i.data.type}, function(a) {
            for(let d=0;d<a.data.length;d++){
                a.data[d].addtime = i.getLocalTime(a.data[d].addtime)
            }
            var t = {
                list:a.data,
                show: !0
            }
            i.setData(t)
            console.log(a.data)
        })
    },
    getInfo: function() {
        var i = this;
        console.log(i)
        e.get("commission/getreward", {type:i.data.type}, function(a) {
            for(let d=0;d<a.data.length;d++){
                a.data[d].addtime = i.getLocalTime(a.data[d].addtime)
            }
            var t = {
                list:a.data,
                show: !0
            }
            i.setData(t)
            console.log(a.data)
        })
    },
    getLocalTime: function(nS) { 
        return new Date(parseInt(nS) * 1000).toLocaleString();
    },
    select: function(event){
        //console.log(event)
        var i = this
        i.setData({
            type:event.currentTarget.dataset.type
        })
        i.getInfo()
    }
  
});